<%@ page language="java" import="java.util.*" pageEncoding="UTF-8" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>机构-酒店房间表管理</title>
    <meta content='width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no' name='viewport'>

    <jsp:include page="../com/header.jsp"></jsp:include>
    <script type="text/javascript" src="../../js/comm/listcomm.js"></script>
    <script type="text/javascript">
        var contentUrl = root + "cms/insHotelRoomsTable/findInsHotelRoomsTableNEStatusPage";
        var editUrl = 'insHotelRoomsTableEdit.jsp?id=';
        var operateUrl = root + 'cms/insHotelRoomsTable/operateInsHotelRoomsTableByIds';
        var listurl = root + "cms/insHotelRoomsTable/findInsHotelRoomsListById";
        function getfilter() {
            var _jsonFilter = "{";
            if (getUrlParam("institutionId")) {
                _jsonFilter += "'search_EQ_institutionId':'" + getUrlParam("institutionId") + "',";
            }
            if ($("#search_HotelRooms_Name").val() && $("#search_HotelRooms_Name").val().length > 0) {
                _jsonFilter += "'search_LIKE_hotelRooms_Name':'" + $("#search_HotelRooms_Name").val().replace("'", "\"") + "',";
            }
            if ($("#search_hourseType").val() && $("#search_hourseType").val().length > 0) {
                _jsonFilter += "'search_EQ_hourseType':'" + $("#search_hourseType").val().replace("'", "\"") + "',";
            }

            if (_jsonFilter != "{") {
                _jsonFilter = _jsonFilter.substring(0, _jsonFilter.length - 1);
            }
            _jsonFilter += "}";
            return _jsonFilter;
        }

        $(function(){

            //设置institutionId值
            $("#institutionId").val(getUrlParam("institutionId"));

            //点击新增按钮
            $("#addSome_rooms").click(function(){
                location.href = editUrl + "0" + '&institutionId=' + getUrlParam("institutionId");
            });

            //点击修改按钮
            $("#updateSome_rooms").click(function(){
                var updateArray = [];
                $(".ckSelect").each(function(){
                    var check=$(this).is(':checked');
                    if(check){
                        var _id =$(this).attr("ckId");
                        updateArray.push(_id);
                    }
                });
                if(updateArray.length == 0){
                    myAlert("请选择要编辑的项"); return;
                }
                if(updateArray.length > 1){
                    myAlert("每次只能编辑一项"); return;
                }
                var institutionId = $("#institutionId").val();
                var from = window.location.href.split("?")[0] + "?nextPage=" + (parseInt($("#_click_page").val())+1) + "&pageSize=" + $("#selectPageSize").val();
                location.href = editUrl + updateArray[0] + '&institutionId=' + institutionId + '&from=' + from;
            });
        });
    </script>
</head>
<body>
<section>
    <div>
        <div class="col-xs-12">
            <div class="box">
                <form id="search_form" class="form-horizontal">
                    <div class="tabSelect" id="selectHeadId">
                        <br>
                        <input type="hidden" id="institutionId" name="institutionId" value="" />
                        <div class="form-group  col-md-3 search-form">
                            <label class="col-md-4 control-label controls" for="">房型名称：</label>
                            <div class="col-md-8">
                                <input type="text" placeholder="房型名称" class="form-control input-sm"
                                       id="search_HotelRooms_Name" name="HotelRooms_Name"/>
                            </div>
                        </div>
                        <div class="form-group  col-md-3 search-form">
                            <label class="col-md-4 control-label controls" for="">房型</label>
                            <div class="col-md-8">
                                <select class="form-control input-sm" id="search_hourseType" name="hourseType">
                                    <option value="">请选择</option>
                                    <option value="单人间">单人间</option>
                                    <option value="双人间">双人间</option>
                                    <option value="多人间">多人间</option>
                                    <option value="小套">小套</option>
                                    <option value="中套">中套</option>
                                    <option value="大套">大套</option>
                                </select>

                            </div>
                        </div>
                        <input type="button" value="查询" id="search" class="btn btn-primary searchBtn">
                    </div>
                </form>
                <div class="box-body table-responsive" style="clear:both;">
                    <input type="button" value="新增" id="addSome_rooms" class="btn btn-success">
                    <input type="button" value="编辑" id="updateSome_rooms" class="btn btn-info">
                    <input type="button" value="删除" id="deleteSome" class="btn btn-danger">
                    <a href="institutionList.jsp"><input type="button" value="返回" class="btn btn-color"></a>
                </div>
                <div class="box-body table-responsive">
                    <table id="example2" class="table table-bordered table-hover">
                        <thead>
                        <tr>
                            <th width="30"><input type="checkbox" id="_selectAll"/></th>
                            <th width="80">房型名称</th>
                            <th width="80">房型价格（元）</th>
                            <%--<th width="80">库存</th>--%>
                            <th width="80">房型价格单位</th>
                            <th width="80">房型</th>
                            <th width="80">状态</th>
                        </tr>
                        </thead>
                        <!-- 表格内容 start -->
                        <tbody id="mycontent"></tbody>
                        <!-- 表格内容 end -->
                    </table>
                    <!-- 分页标签 start -->
                    <div class="row page_big_div" id="displayPage"></div>
                    <!-- 分页标签 end -->
                    <script id="tableContentTmple" type="text/x-jsrender">
								<tr>
									<td><input id="ck_{{:id}}" ckId="{{:id}}" ckStatus="{{:status}}" class="ckSelect" type="checkbox" /></td>
									<td>{{:hotelRooms_Name}}</td>
									<td title={{:hotelRooms_Price}} style="vertical-align:middle; text-align:right;">{{toThousands:hotelRooms_Price}}</td>
									<%--<td>{{:hotelRooms_Inventory}}</td>--%>
									<td>{{:hotelRooms_Price_unit}}</td>
									<td>{{:hourseType}}</td>
									<td>{{if status==1}}正常{{else status==2}}已发布{{else status==3}}已删除{{else status==-1}}已锁定{{else}}无效{{/if}}</td>
								</tr>



                    </script>
                </div>
            </div>
        </div>
</section>
</body>
</html>